package com.atguigu.gmall.web.controller;

import com.atguigu.gmall.model.product.SkuInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: lx
 * @Time: 11:37
 * @Description:
 */
//@Controller
public class HelloController {

    //
    @GetMapping(value = {"/hello","/trade.html"})
    public String hello(Map map , HttpSession httpSession){
        httpSession.setAttribute("gname","<span style=\"color:green\">宝强</span>");
        httpSession.setAttribute("world","shijie");
        map.put("world","世界你好");
        SkuInfo skuInfo = new SkuInfo();
        skuInfo.setId(123L);
        map.put("skuInfo",skuInfo);
        List<SkuInfo> skuInfoList = new ArrayList<>();
        SkuInfo skuInfo1 = new SkuInfo();
        skuInfo1.setId(123L);
        SkuInfo skuInfo2 = new SkuInfo();
        skuInfo2.setId(345L);
        skuInfoList.add(skuInfo1);
        skuInfoList.add(skuInfo2);
        map.put("skuInfoList",skuInfoList);
        return "hello";
    }

}
